﻿using Furion.ConfigurableOptions;
using Sorting.App.Models.Enum;

namespace Sorting.App.Models
{


    public class AllConfigModel
    {

        public CommonConfigOptions CommonConfig { get; set; }


        public RabbitMqOptionDto RabbitOptions { get; set; }

        public RabbitMq RabbitMq { get; set; }

    }



    public class RabbitMq
    {
        public bool UseProducer { get; set; }

        public bool UseConsumer { get; set; }



        public RabbitMqOptionDto RabbitOptions { get; set; }

        public List<RabbitMqHandler> RabbitMqHandler { get; set; }


        public List<Consumers> Consumers { get; set; }
    }


    public class RabbitMqHandler
    {

        public string NameSpace { get; set; }

        public string Handler { get; set; }

    }

    public class Consumers
    {


        public string ExchangeName { get; set; }

        public string RoutingKey { get; set; }


        public string AutoAck { get; set; }

    }

    /// <summary>
    /// 基础配置项目
    /// </summary>
    public class CommonConfigOptions : IConfigurableOptions
    {


        /// <summary>
        /// 默认储位
        /// </summary>
        public int DefaultNo { get; set; }


        /// <summary>
        /// 档位设置
        /// </summary>
        public EnumPlcGear Gear
        {
            get; set;
        }

        /// <summary>
        /// PLCCOM口
        /// </summary>
        public string PlcPort { get; set; }


        /// <summary>
        /// 扫描枪端口号
        /// </summary>
        public string ScanCom { get; set; }

        /// <summary>
        /// 服务器地址
        /// </summary>
        public string ServiceCon { get; set; }

        /// <summary>
        /// 服务器地址接口前缀
        /// </summary>
        public string ServiceApiPrefix { get; set; }
        /// <summary>
        /// 是否为调试账号
        /// </summary>
        public bool Local { get; set; }
        /// <summary>
        /// 是否初始化
        /// </summary>
        public bool Initial { get; set; }
    }


    /// <summary>
    /// RabbitMq基本信息
    /// </summary>
    public class RabbitMqOptionDto : IConfigurableOptions
    {


        public string Server { get; set; }

        public int Port { get; set; }

        public string ClientId { get; set; }


        public string UserName { get; set; }


        public string Password { get; set; }
    }
    public class RabbitSend<T>
    {
        /// <summary>
        /// 任务类型
        /// </summary>
        public string TaskType { get; set; }


        /// <summary>
        /// 传输的数据内容
        /// </summary>
        public T TaskData { get; set; }


        /// <summary>
        /// 任务消息备注
        /// </summary>
        public string TaskMessage { get; set; }
    }

}
